/*
 * Copyright 2011-2012 Redia A/S
 * 
 * This file is part of Redias Library App for Android.
 *
 *  Redia Library App for Android is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Redia Library App for Android is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with Redia Library App for Android.  If not, see <http://www.gnu.org/licenses/>.
 */
package dk.redia.libraryapp;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import dk.redia.lib.utils.AppApplication;

public class ScannerIntroActivity extends Activity {
	
	private static final String PREFERENCES_NAME = "ScannerIntroActivity";
	private static final String PREFERENCES_SKIP_INTRO = "skipIntro";
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.scannerintro);
	    // TODO Auto-generated method stub
	}
	
	public void onSkipIntroButtonClicked(View button) {
		CheckBox cb = (CheckBox)findViewById(R.id.scannerIntroSkipIntroCheckBox);
		SharedPreferences prefs = getPrefs();
		prefs.edit().putBoolean(PREFERENCES_SKIP_INTRO, cb.isChecked()).commit();
		
		Intent intent = new Intent(this, BarcodeScanActivity.class);
		startActivity(intent);
	}
	
	private static SharedPreferences getPrefs() {
		return AppApplication.getAppContext().getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE);
	}

	public void onSkipIntroCheckBoxClicked(View checkBox) {

	}

	public static boolean skipIntro() {
		return getPrefs().getBoolean(PREFERENCES_SKIP_INTRO, false);
	}
	
}
